import request from "@/utils/request.js"

// 获取工单列表分页
export function getWorkOrders(params) {
  return request({
    url: '/workorder/pageList',
    method: 'get',
    params
  });
}

// 派单
export function assignWorkOrder(data) {
  return request({
    url: '/workorder/assign',
    method: 'post',
    data
  });
}

// 收单
export function receiveWorkOrder(data) {
  return request({
    url: '/workorder/receive',
    method: 'post',
    data
  });
}

// 删除工单
export function deleteWorkOrder(id) {
  return request({
    url: `/workorder/delete/${id}`,
    method: 'delete'
  });
}

// 获取未派单工单
export function getUnassignedWorkOrders(params) {
  return request({
    url: '/workorder/unassigned',
    method: 'get',
    params
  });
}

// 获取已派单工单
export function getAssignedWorkOrders(params) {
  return request({
    url: '/workorder/assigned',
    method: 'get',
    params
  });
}

// 获取操作员列表
export function getOperators() {
  return request({
    url: '/workorder/operators',
    method: 'get'
  });
}
export function updateWorkOrder(data) {
  return request({
    url: '/workorder/update',
    method: 'put',
    data
  });
}
